using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Janus.BaseEntitys;
using Janus.Mes.DTO;
using Janus.Mes.IDal;
using Janus.Mes.POCO;
using Janus.Cores.Linq;
using Janus.Cores.Extension;

namespace Janus.Mes.SqlDal
{
    /// <summary>
    ///    
    /// </summary> 
    public partial class SysDictionaryDal
    {
        public bool SaveMutil(SysDictionaryDTO model)
        {
            var poco = model.ToEntity<SysDictionary>();
            var result = false;
            result = base.Transaction(() =>
            {
                base.Save<SysDictionary>(poco);
                //base.Delete<SysDictionary>(c => c.GroupName == model.GroupName && c.DecKey != model.GroupName);
                if (poco.SubDics.HasValues())
                {
                    base.Save<SysDictionary>(poco.SubDics);
                }
                return true;
            });
            return result;
        }
    }
}
